//
// Created by hsj on 2022/3/10.
//

#include "t_IO.h"
namespace t_IO_test{
    void test(){
        //中文在linux上面正常
        cout<<"你好，我是中国人！"<<endl;
        cerr<<"you are not allowed."<<endl;

        cout<<"________________"<<endl;
        cout.put(65)<<endl;
        cout.put('H').put('S').put('J')<<endl;

        cout<<"________________"<<endl;
        long l = 123456789L;
        //将会输出乱码
        cout.write((char*)&l,sizeof l)<<endl;

        cout<<"________________"<<endl;
        //前置刷新缓冲区
        cout<<"HSJ is smart chinese people."<<flush<<endl;

        cout<<"________________"<<endl;
        cout<<(1.1110000000007 + 1.1110000000005)<<endl;

        cout<<"________________"<<endl;
        //自动填充的功能
        cout.fill('*');
        const int NUM = 2;
        int num[NUM]{123,4567};
        for (int i = 0; i < NUM; ++i) {
            cout.width(8);
            cout<<num[i]<<endl;
        }

        cout<<"//////////////////////////////////////////////////////"<<endl;
    }
}